<?php


namespace app\api\controller\v1;


use app\adminapi\controller\AuthController;
use app\exceptions\AuthException;
use app\services\office\OfficeStudentService;
use think\facade\App;

class RegisterUser extends AuthController
{
    public function __construct(App $app,OfficeStudentService  $service)
    {
        parent::__construct($app);
        $this ->services = $service;
    }
    /*
     * 用户登录
     */
    public function index(){
        $where = $this->request->postMore([
            ['idcard', ''],
            ['pwd',''],
            ['website_id',$this  -> website],
        ]);
        return app()->make('json')->successful($this->services->register($where));
    }

    /**
     * jwt换取身份信息
     * @return void
     */
    public function info(){
        $where = $this->request->postMore([
            ['jwt', ''],
        ]);
        if (!$where['jwt']) throw new AuthException('缺少必要参数！');
        return app()->make('json')->successful($this->services->info($where));
    }

}